package com.liu.proxy;

import com.liu.proxy.core.MapperProxyFactory;
import com.liu.spring.domain.User;
import com.liu.spring.mapper.UserMapper;

import java.util.List;

/**
 * @author LIU
 * @version 1.0
 * @date 2024/1/15 18:05
 * @description
 *
 * 简单模拟MyBatis代理类实现
 *  1. SQL解析
 *
 *  2. 参数解析
 *       select、param注解实现
 *
 *  3. 执行SQL
 *
 *  4. 结果处理
 *       策略模式
 *       入参类型处理器   typeHandlerMap
 */
public class ProxyTest {

    public static void main(String[] args) {
        UserMapper mapper = MapperProxyFactory.getMapper(UserMapper.class);
        List<User> result = mapper.getUser("tomcat",10);
        User user = mapper.getUserById(1);

        System.out.println(result);
        System.out.println(user);
    }
}
